package com.reny.ll.git.base_logic.utils

import android.os.SystemClock

class ClickUtils {

    companion object{

        private var lastClickTime: Long = 0

        fun isFastClick() : Boolean{
            val time = SystemClock.elapsedRealtime()
            if (time - lastClickTime < 500) {
                return true
            }
            lastClickTime = time
            return false
        }



        private val clickMap = HashMap<Any, Long>()

        @JvmStatic
        fun isDoubleClick(key:Any) : Boolean{
            if(!clickMap.containsKey(key)){
                clickMap[key] = 0
            }

            val time = SystemClock.elapsedRealtime()
            if (time - clickMap[key]!! < 500) {
                return true
            }
            clickMap[key] = time
            return false
        }



    }

}